/*
 * wiper.h
 *
 *  Created on: 15-03-2013
 *      Author: MCzepczyński
 */

#ifndef WIPER_H_
#define WIPER_H_



/******************************************************************************************
 *	Makrodefinicje															 			 *
 *****************************************************************************************/
#define WIPER_DDR			DDRD
#define WIPER_PORT			PORTD
#define WIPER_PIN			PIND
#define WIPER				(1 << PD6)

#define WIPER_RELAY_DDR		DDRD
#define WIPER_RELAY_PORT	PORTD
#define WIPER_RELAY			(1 << PD7)

#define WIPER_RELAY_ON		WIPER_RELAY_PORT &= ~WIPER_RELAY
#define WIPER_RELAY_OFF		WIPER_RELAY_PORT |= (WIPER_RELAY)

#define WIPER_RELAY_DELAY	100		// 100 = 1s

#define WIPER_CYCLE_TIME	180		//1.8s

#define WIPER_POT_1			158
#define WIPER_POT_2			223
#define WIPER_POT_3			410
#define WIPER_POT_4			577
#define WIPER_POT_5			707
#define WIPER_POT_6			819
#define WIPER_POT_7			940
#define WIPER_POT_8			950

#define WIPER_POT_DIFF		30

/******************************************************************************************
 *	Deklaracje dołączanych plików nagłówkowych i bibliotek								 *
 *****************************************************************************************/
#include <avr/io.h>


extern volatile uint8_t w_stat, wiper_status, wiper_status_temp;
extern enum states {idle, delay, check_imp, interval};
/******************************************************************************************
 *	Deklaracje funkcji								 									 *
 *****************************************************************************************/
uint8_t check_wipers(void);
uint16_t check_interval(void);
void wipers(void);
void wipers_default(void);

#endif /* WIPER_H_ */

/******************************************************************************************
 *	Koniec pliku wipers.h
 *****************************************************************************************/
